
//
//  HJDDetailTimeTableViewController.m
//  JYHospital
//
//  Created by 胡金东 on 16/5/24.
//  Copyright © 2016年 胡金东. All rights reserved.
//

#import "HJDDetailTimeTableViewController.h"
#import "HJDCTimeModel.h"

@interface HJDDetailTimeTableViewController ()<UIScrollViewDelegate>

//整体页面
@property (nonatomic,strong)UIScrollView *scroll;

@property (nonatomic,strong)  UILabel *CTimeLbl;

@property (nonatomic,strong)  UILabel *projectLbl;

@property (nonatomic,strong)  UILabel * projectFourLbl;


@end

@implementation HJDDetailTimeTableViewController

-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"产检时间表";
    self.navigationItem.rightBarButtonItem = [UIBarButtonItem itemWithTarget:self action:@selector(shareBtnClick) image:@"矢量智能对象" HighImage:nil];
    
    [self setUpWeek];
    [self setUpStess];
    [self setUpProject];
    [self setUpAttention];
}

-(void)setUpWeek
{
    self.scroll = [[UIScrollView alloc]initWithFrame:[UIScreen mainScreen].bounds];
    self.scroll.delegate = self;
    
    self.automaticallyAdjustsScrollViewInsets = YES;
    self.scroll.showsVerticalScrollIndicator = YES;//垂直移动
    self.scroll.showsHorizontalScrollIndicator = NO;//水平移动
    //上下滑动
    self.scroll.contentSize = CGSizeMake(HJDWidth,855 ) ;
   [self.view addSubview: self.scroll];
    
    CGFloat weekX = HJDHorizontalMargin/2;
    CGFloat weekY = HJDVerticalMargin ;
    UILabel *weekLbl = [[UILabel alloc]init];
    weekLbl.font = [UIFont systemFontOfSize:20];
    weekLbl.text = self.ctimeModel.week;
       CGSize weekSize = [weekLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:weekLbl.font,NSFontAttributeName, nil]];
    weekLbl.frame = (CGRect){{weekX,weekY},weekSize};
    [self.scroll addSubview:weekLbl];
    
    CGFloat CTimeX = HJDHorizontalMargin/2;
    CGFloat CTimeY = CGRectGetMaxY(weekLbl.frame) + 5;
    self.CTimeLbl = [[UILabel alloc]init];
    self.CTimeLbl.font = [UIFont systemFontOfSize:18];
    self.CTimeLbl.text = @"产检时间" ;
    self.CTimeLbl.textColor = [UIColor lightGrayColor];
    CGSize CTimeSize = [self.CTimeLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.CTimeLbl.font,NSFontAttributeName, nil]];
    self.CTimeLbl.frame = (CGRect){{CTimeX,CTimeY},CTimeSize};
    [self.scroll addSubview:self.CTimeLbl];


    CGFloat dateX = CGRectGetMaxX(self.CTimeLbl.frame) + HJDHorizontalMargin * 2;
    CGFloat dateY = CTimeY;
    UILabel  *dateLbl = [[UILabel alloc]init];
    dateLbl.font = [UIFont systemFontOfSize:18];
    dateLbl.text = @"2016-02-08";
    dateLbl.textColor = [UIColor lightGrayColor];
    CGSize dateSize = [dateLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:dateLbl.font,NSFontAttributeName, nil]];
    dateLbl.frame = (CGRect){{dateX,dateY},dateSize};
    [self.scroll addSubview:dateLbl];
    
    CGFloat weekkX = CGRectGetMaxX(dateLbl.frame) + 5;
    CGFloat weekkY = CTimeY;
    UILabel  *weekkLbl = [[UILabel alloc]init];
    weekkLbl.font = [UIFont systemFontOfSize:18];
    weekkLbl.text = @"(星期一)";
    weekkLbl.textColor = [UIColor lightGrayColor];
    CGSize weekkSize = [weekkLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:weekkLbl.font,NSFontAttributeName, nil]];
    weekkLbl.frame = (CGRect){{weekkX,weekkY},weekkSize};
    [self.scroll addSubview:weekkLbl];
}

-(void)setUpStess
{
    CGFloat stessX = HJDHorizontalMargin/2;
    CGFloat stessY = CGRectGetMaxY(self.CTimeLbl.frame) + HJDVerticalMargin;
    UILabel *stessLbl = [[UILabel alloc]init];
    stessLbl.font = [UIFont systemFontOfSize:20];
    stessLbl.text = @"本周重点";
    CGSize stessSize = [stessLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:stessLbl.font,NSFontAttributeName, nil]];
    stessLbl.frame = (CGRect){{stessX,stessY},stessSize};
    [self.scroll addSubview:stessLbl];
    
    CGFloat projectX = HJDHorizontalMargin/2;
    CGFloat projectY = CGRectGetMaxY(stessLbl.frame) +5;
    self.projectLbl = [[UILabel alloc]init];
   self.projectLbl.font = [UIFont systemFontOfSize:18];
    self.projectLbl.text = self.ctimeModel.project;
    self.projectLbl.textColor = [UIColor lightGrayColor];
    CGSize projectSize = [_projectLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:self.projectLbl.font,NSFontAttributeName, nil]];
    self.projectLbl.frame = (CGRect){{projectX,projectY},projectSize};
    [self.scroll addSubview:self.projectLbl];

}

-(void)setUpProject
{
    CGFloat cProjectX = HJDHorizontalMargin/2;
    CGFloat cProjectY = CGRectGetMaxY(self.projectLbl.frame) + HJDVerticalMargin;
    UILabel *cProjectLbl = [[UILabel alloc]init];
    cProjectLbl.font = [UIFont systemFontOfSize:20];
    cProjectLbl.text = @"产检项目";
    CGSize cProjectSize = [cProjectLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:cProjectLbl.font,NSFontAttributeName, nil]];
    cProjectLbl.frame = (CGRect){{cProjectX,cProjectY},cProjectSize};
    [self.scroll addSubview:cProjectLbl];
    
    CGFloat imageOneX = HJDHorizontalMargin/2;
    CGFloat imageOneY = CGRectGetMaxY(cProjectLbl.frame) + HJDVerticalMargin/2;
    CGFloat imageOneW = 10;
    CGFloat imageOneH = 10;
    UIImageView *imageOne = [[UIImageView alloc]initWithFrame:CGRectMake(imageOneX, imageOneY, imageOneW, imageOneH)];
    imageOne.image = [UIImage imageNamed:@"图层-35-拷贝"];
    [self.scroll addSubview:imageOne];
    
    CGFloat projectOneX = CGRectGetMaxX(imageOne.frame)+HJDHorizontalMargin/2;
    CGFloat projectOneY = CGRectGetMaxY(cProjectLbl.frame) + 5;
    CGFloat projectOneW = HJDWidth - (HJDHorizontalMargin + 10)* 2;
    UILabel * projectOneLbl = [[UILabel alloc]init];
    projectOneLbl.numberOfLines = 0;
    projectOneLbl.text = @"建立妊娠期保健手册（确定孕周、推算预产期、评估妊娠期高危等因素）";
    projectOneLbl.textColor = [UIColor lightGrayColor];
    CGRect projectOneRect = [projectOneLbl.text boundingRectWithSize:CGSizeMake(projectOneW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:projectOneLbl.font,NSFontAttributeName, nil] context:nil];
    projectOneLbl.frame = (CGRect){{projectOneX,projectOneY},projectOneRect.size};
    [self.scroll addSubview:projectOneLbl];
    
    CGFloat imageTwoX = HJDHorizontalMargin/2;
    CGFloat imageTwoY = CGRectGetMaxY(projectOneLbl.frame) + HJDVerticalMargin/2;
    CGFloat imageTwoW = 10;
    CGFloat imageTwoH = 10;
    UIImageView *imageTwo = [[UIImageView alloc]initWithFrame:CGRectMake(imageTwoX, imageTwoY, imageTwoW, imageTwoH)];
    imageTwo.image = [UIImage imageNamed:@"图层-35-拷贝"];
    [self.scroll addSubview:imageTwo];
    
    CGFloat projectTwoX = CGRectGetMaxX(imageTwo.frame) + HJDHorizontalMargin/2;
    CGFloat projectTwoY = CGRectGetMaxY(projectOneLbl.frame) + 5;
    CGFloat projectTwoW = HJDWidth - (HJDHorizontalMargin + 10)* 2;
    UILabel * projectTwoLbl = [[UILabel alloc]init];
    projectTwoLbl.numberOfLines = 0;
    projectTwoLbl.text = @"建立妊娠期保健手册（确定孕周、推算预产期、评估妊娠期高危等因素）";
    projectTwoLbl.textColor = [UIColor lightGrayColor];
    CGRect projectTwoRect = [projectTwoLbl.text boundingRectWithSize:CGSizeMake(projectTwoW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:projectTwoLbl.font,NSFontAttributeName, nil] context:nil];
    projectTwoLbl.frame = (CGRect){{projectTwoX,projectTwoY},projectTwoRect.size};
    [self.scroll addSubview:projectTwoLbl];
    
    CGFloat imageThreeX = HJDHorizontalMargin/2;
    CGFloat imageThreeY = CGRectGetMaxY(projectTwoLbl.frame) + HJDVerticalMargin/2;
    CGFloat imageThreeW = 10;
    CGFloat imageThreeH = 10;
    UIImageView *imageThree = [[UIImageView alloc]initWithFrame:CGRectMake(imageThreeX, imageThreeY, imageThreeW, imageThreeH)];
    imageThree.image = [UIImage imageNamed:@"图层-35-拷贝"];
    [self.scroll addSubview:imageThree];
    
    CGFloat projectThreeX = CGRectGetMaxX(imageThree.frame) + HJDHorizontalMargin/2;
    CGFloat projectThreeY = CGRectGetMaxY(projectTwoLbl.frame) + 5;
    CGFloat projectThreeW = HJDWidth - (HJDHorizontalMargin + 10)* 2;
    UILabel * projectThreeLbl = [[UILabel alloc]init];
    projectThreeLbl.numberOfLines = 0;
    projectThreeLbl.text = @"建立妊娠期保健手册（确定孕周、推算预产期、评估妊娠期高危等因素）";
    projectThreeLbl.textColor = [UIColor lightGrayColor];
    CGRect projectThreeRect = [projectThreeLbl.text boundingRectWithSize:CGSizeMake(projectThreeW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:projectThreeLbl.font,NSFontAttributeName, nil] context:nil];
    projectThreeLbl.frame = (CGRect){{projectThreeX,projectThreeY},projectThreeRect.size};
    [self.scroll addSubview:projectThreeLbl];
    
    CGFloat imageFourX = HJDHorizontalMargin/2;
    CGFloat imageFourY = CGRectGetMaxY(projectThreeLbl.frame) + HJDVerticalMargin/2 ;
    CGFloat imageFourW = 10;
    CGFloat imageFourH = 10;
    UIImageView *imageFour = [[UIImageView alloc]initWithFrame:CGRectMake(imageFourX, imageFourY, imageFourW, imageFourH)];
    imageFour.image = [UIImage imageNamed:@"图层-35-拷贝"];

    [self.scroll addSubview:imageFour];
    
    CGFloat projectFourX = CGRectGetMaxX(imageFour.frame) +  HJDHorizontalMargin/2;
    CGFloat projectFourY = CGRectGetMaxY(projectThreeLbl.frame) + 5;
    CGFloat projectFourW = HJDWidth - (HJDHorizontalMargin + 10)* 2;
  self.projectFourLbl = [[UILabel alloc]init];
    self.projectFourLbl.numberOfLines = 0;
    self.projectFourLbl.text = @"建立妊娠期保健手册（确定孕周、推算预产期、评估妊娠期高危等因素）";
    self.projectFourLbl.textColor = [UIColor lightGrayColor];
    CGRect projectFourRect = [_projectFourLbl.text boundingRectWithSize:CGSizeMake(projectFourW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:self.projectFourLbl.font,NSFontAttributeName, nil] context:nil];
    self.projectFourLbl.frame = (CGRect){{projectFourX,projectFourY},projectFourRect.size};
    [self.scroll addSubview:self.projectFourLbl];
    

}

-(void)setUpAttention
{
    CGFloat weekCareX = HJDHorizontalMargin/2;
    CGFloat weekCareY = CGRectGetMaxY(self.projectFourLbl.frame) + HJDVerticalMargin;
    UILabel *weekCareLbl = [[UILabel alloc]init];
    weekCareLbl.font = [UIFont systemFontOfSize:20];
    weekCareLbl.text = @"本周注意";
    CGSize weekCareSize = [weekCareLbl.text sizeWithAttributes:[NSDictionary dictionaryWithObjectsAndKeys:weekCareLbl.font,NSFontAttributeName, nil]];
    weekCareLbl.frame = (CGRect){{weekCareX,weekCareY},weekCareSize};
    [self.scroll addSubview:weekCareLbl];
    
    CGFloat careContentX = HJDHorizontalMargin/2;
    CGFloat careContentY = CGRectGetMaxY(weekCareLbl.frame) + 5;
    CGFloat careContentW = HJDWidth - HJDHorizontalMargin ;
    UILabel *careContentLbl = [[UILabel alloc]init];
    careContentLbl.numberOfLines = 0;
    careContentLbl.text = @"准妈妈在孕期12周时正式进行第一次产检。医院通常会给准妈妈办理“孕妇健康手册”。医师日后为每位妈妈做各项产检时，也会依据手册记载的检查项目分别进行记录。为前没有做过婚检、孕前检查的人，还要增加地中海贫血的刷查，家里养宠物的让你，则要增加寄生虫检查。";
    careContentLbl.textColor = [UIColor lightGrayColor];
    CGRect careContentRect = [careContentLbl.text boundingRectWithSize:CGSizeMake(careContentW, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObjectsAndKeys:self.projectFourLbl.font,NSFontAttributeName, nil] context:nil];
    careContentLbl.frame = (CGRect){{careContentX,careContentY},careContentRect.size};
    [self.scroll addSubview:careContentLbl];
    
}

-(void)shareBtnClick
{
    NSLog(@"分享");
}

@end
